package com.lxb;

public class SearchInsert {
    public static void main(String[] args) {

        int arr[] = {1,2,3,4,6,7};
        int num = 9;
        int tar = 0;
        for(int i=0;i<arr.length;i++){
            if(num == arr[i]){
                tar = i;
                break;
            }
            if(num < arr[0]){
                tar = 0;
                break;
            }
            if(num > arr[arr.length-1]){
                tar = arr.length;
                break;
            }
            if(num > arr[i] && num < arr[i+1]){
                tar = i+1;
                break;
            }
        }

        System.out.println(tar);


    }
}
